export interface visibleEditorBlocks {
    top: number,
    left: number
}
export interface visibleEditorModelValue {

    container:{
        width:number,
        height:number
    },
    blocks?: visibleEditorBlocks []
}

export interface visibleEditorComponent {
    key: string,
    label: string,
    preview: () => (JSX.Element),
    render: () => (JSX.Element)
}

export function createVisibleEditorConfig () {
    const componentList: visibleEditorComponent[] = [];
    const componentMap: Record<string, visibleEditorComponent> = {};
    return {
        componentList,
        componentMap,
        registry: (key: string, component: Omit<visibleEditorComponent, 'key'>) => {
            let comp = {...component, key};
            componentList.push(comp);
            componentMap[key] = comp;
        }
    }
}

export type visibleEditorConfig = ReturnType<typeof createVisibleEditorConfig>
